home *** CD-ROM | disk | FTP | other *** search
- /*
- * The original copyright owners of the accompanying source code files have
- * agreed to place such code into the public domain. Accordingly, anyone
- * who receives or obtains a copy of such source code is freely entitled to
- * reproduce, use and otherwise exploit such code (including the right to
- * make derivative works), at his/her own risk and expense, without any
- * obligation or liability to the original copyright owners.
- *
- * We would appreciate (but do not require) that the following message be
- * included in any derivative works:
- *
- * "Portions of this program were developed by Peter Broadwell, Rob Myers
- * and Robin Schaufler while working in Silicon Valley."
- *
- * The accompanying source code files and related documentation materials
- * are distributed on an "AS IS" basis, without any warranties or
- * guarantees of any kind. All implied warranties, including the implied
- * warranties of merchantability and of fitness for any particular purpose,
- * are expressly disclaimed.
- */
- #include <stdio.h>
- #include <ctype.h>
- #include "gl.h"
- #include "math.h"
- #include "geom.h"
- #include "colors.h"
- #include "objIds.h"
- #include "class.h"
- #include "classIds.h"
- #include "selectors.h"
- #include "mbox.h"
- #include "individual.h"
- #include "behavior.h"
- #include "doers.h"
- #include "panel.h"
- #include "voxel.h"
-
- extern individual *us;
- extern individual *curIndiv;
- extern long masterClock;
- extern panel *makeBHMenu();
- extern masterPanel *thePanel;
-
- extern subscr *findvars();
-
- /*
- * add a menu containing a title for self to the panel p
- * that results in a confirmer allowing you to either dismiss
- * the confirmer or toss the behavior.
- */
- addBHMenu(self, p, name)
- behavior *self;
- panel *p;
- char *name;
- {
- int flags;
- point2d buttons;
- rectangle scrArea;
-
- makeobj((Object)name);
- fishColor(PANEL_BLACK);
- rectfi(0,0, strwidth(name), getheight());
- fishColor(PANEL_GRAY5);
- cmov2i(0, 10);
- charstr(name);
- closeobj();
- makeobj((Object)(name+1));
- fishColor(PANEL_GRAY7);
- /*
- recti(2,2, strwidth(name)+4, getheight()+4);
- */
- cmov2i(0, 10);
- charstr(name);
- closeobj();
-
- buttons.x = 1;
- buttons.y = 1;
- flags = NULL;
- setrect(&scrArea, 0,0, strwidth(name), getheight());
- p->kids = makeBHMenu(p->kids, p, flags, &scrArea, &buttons,
- self, TOSSBEHAVIOR, name, name+1);
-
- /* bump parent's extent */
- p->area.extent.x = max(p->area.extent.x, scrArea.orig.x+scrArea.extent.x);
- p->area.extent.y += scrArea.extent.y;
- }
-
- /*
- * toss self from curIndiv.
- */
- tossBehavior(self)
- behavior *self;
- {
- emptyPanel(thePanel);
- unsubscribe(self, curIndiv);
- Msg(thePanel, INIT, NOARG, NULL);
- Msg(curIndiv, ADDPANEL, NOARG, NULL);
- }
-
- /*
- * cancel the confirmer.
- */
- canConfirmer(self)
- behavior *self;
- {
- printf("Can the confirmer.");
- emptyPanel(thePanel);
- Msg(curIndiv, ADDPANEL, PTR, thePanel);
- }
-